package com.kaishengit.action;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.web.context.ServletContextAware;

import com.opensymphony.xwork2.ActionSupport;

public abstract class BaseAction extends ActionSupport implements SessionAware,ServletRequestAware,ServletResponseAware,ServletContextAware{

	private static final long serialVersionUID = 1L;
	
	private ServletContext application;
	private HttpServletRequest request;
	private HttpServletResponse response;
	private Map<String,Object> session;
	
	
	@Override
	public String execute() throws Exception {
		return list();
	}

	public abstract String list() throws Exception;
	public abstract String save() throws Exception;
	public abstract String edit() throws Exception;
	public abstract String del() throws Exception;
	public abstract String toSave() throws Exception;
	public abstract String toEdit() throws Exception;


	public void setServletContext(ServletContext application) {
		this.application = application;
	}

	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}

	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	public void setSession(Map<String, Object> session) {
		this.session = session;
	}

	public ServletContext getApplication() {
		return application;
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	public HttpServletResponse getResponse() {
		return response;
	}

	public Map<String, Object> getSession() {
		return session;
	}
	
	

}
